package cn.lili.modules.union.mapper;

import cn.lili.modules.member.entity.dos.Union;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface UnionMapper extends BaseMapper<Union> {


    @Select("select un.*,u.username as chairman_name,u.face as chairman_portrait,(select count(1) from li_union_member m where m.union_id = un.id ) as memberCount from li_union un left join li_user u on un.chairman_id=u.id where un.id = #{unionId}")
    Union getUnionInfo(@Param("unionId") String unionId);

    Page<Union> getByPage(Page page, @Param("union") Union union);
}
